package com.wanhe.base.model.disgn;

import com.orhanobut.logger.Logger;

import java.util.List;

/**
 * File Name:ViewItem.java<br/>
 * Package Name:com.wanhe.base.model.disgn<br/>
 * Date:2017/7/10 14:30<br/>
 * author:chendeji<br/>
 * desc: 2.0设计器控件信息基础类<br/>
 * Copyright (c) 2017/7/10, 781571323@qq.com All Rights Reserved.
 *
 */
public class ViewItem {

	public static final String	VIEW_TYPE_ITEM		= "item";
	public static final String	VIEW_TYPE_VIRTUAL	= "virtual";
	public static final String	VIEW_TYPE_IMAGE		= "image";
	public static final String	VIEW_TYPE_VIDEO		= "video";
	public static final String	VIEW_TYPE_GIF		= "gif";
	public static final String	VIEW_TYPE_HIGHLIGHT	= "highlight";
	public static final String	VIEW_TYPE_POPUP		= "popup";
	public static final String	VIEW_TYPE_POPUPOP	= "popupOp";
	public static final String	VIEW_TYPE_DATASTORE	= "datastore";
	public static final String	VIEW_TYPE_COMBO		= "combo";
	public static final String	VIEW_TYPE_GROUP		= "group";
	public static final String	VIEW_TYPE_SUITE		= "suite";
	public static final String	VIEW_TYPE_PING		= "ping";
	public static final String	VIEW_TYPE_SLIDE		= "slide";
	public static final String	VIEW_TYPE_TEXT		= "text";
	public static final String	VIEW_TYPE_ANIMATE	= "animate";

	/**
	 * id : 1495f6b5-be3c-413a-873e-dd33bf37fa2b
	 * cid : 4
	 * name : 新鲜肥牛
	 * type : item
	 * visible : true
	 * events : []
	 * price1 : {}
	 * plus : {}
	 * txt1 : {}
	 * hit : {}
	 * price2 : {}
	 * nametxt : {}
	 */

	private String	id;
	private int		cid;
	private String	name;
	private String	type;
	private boolean	visible;

	private ViewPort	price1;
	private ViewPort	plus;
	private ViewPort	txt1;
	private ViewPort	hit;
	private ViewPort	price2;
	private ViewPort	nametxt;

	private List <Event> events;

	private ViewPort viewport;

	private int file;

	// =====================================特殊的弹窗控件=========================================
	private int page;

	// ======================================视频控件的属性========================================
	private boolean	autoPlay;
	private boolean	loop;

	// ======================================套餐分组属性======================================
	int	max;
	int	min;

	// ======================================计数规则属性======================================
	private CountRule custom;

	// ======================================所属菜品分类======================================
	private int tid;

	// ======================================动画属性======================================
	private String	actionIn;
	private String	actionOut;

	private int	durationIn	= 350;
	private int	durationOut	= 350;

	public int getDurationIn() {
		return durationIn;
	}

	public void setDurationIn(int durationIn) {
		this.durationIn = durationIn;
	}

	public int getDurationOut() {
		return durationOut;
	}

	public void setDurationOut(int durationOut) {
		this.durationOut = durationOut;
	}

	public String getActionIn() {
		return actionIn;
	}

	public void setActionIn(String actionIn) {
		this.actionIn = actionIn;
	}

	public String getActionOut() {
		return actionOut;
	}

	public void setActionOut(String actionOut) {
		this.actionOut = actionOut;
	}

	public int getTid() {
		return tid;
	}

	public void setTid(int tid) {
		this.tid = tid;
	}

	public CountRule getCustom() {
		return custom;
	}

	public void setCustom(CountRule custom) {
		this.custom = custom;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	public int getMin() {
		return min;
	}

	public void setMin(int min) {
		this.min = min;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public boolean isAutoPlay() {
		return autoPlay;
	}

	public void setAutoPlay(boolean autoPlay) {
		this.autoPlay = autoPlay;
	}

	public boolean isLoop() {
		return loop;
	}

	public void setLoop(boolean loop) {
		this.loop = loop;
	}

	public int getFile() {
		return file;
	}

	public void setFile(int file) {
		this.file = file;
	}

	public void setEvents(List <Event> events) {
		this.events = events;
	}

	public ViewPort getViewport() {
		return viewport;
	}

	public void setViewport(ViewPort viewport) {
		this.viewport = viewport;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getCid() {
		return cid;
	}

	public void setCid(int cid) {
		this.cid = cid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public boolean isVisible() {
		return visible;
	}

	public void setVisible(boolean visible) {
		this.visible = visible;
	}

	public List <Event> getEvents() {
		return events;
	}

	public ViewPort getPrice1() {
		return price1;
	}

	public void setPrice1(ViewPort price1) {
		this.price1 = price1;
	}

	public ViewPort getPlus() {
		return plus;
	}

	public void setPlus(ViewPort plus) {
		this.plus = plus;
	}

	public ViewPort getTxt1() {
		return txt1;
	}

	public void setTxt1(ViewPort txt1) {
		this.txt1 = txt1;
	}

	public ViewPort getHit() {
		return hit;
	}

	public void setHit(ViewPort hit) {
		this.hit = hit;
	}

	public ViewPort getPrice2() {
		return price2;
	}

	public void setPrice2(ViewPort price2) {
		this.price2 = price2;
	}

	public ViewPort getNametxt() {
		return nametxt;
	}

	public void setNametxt(ViewPort nametxt) {
		this.nametxt = nametxt;
	}

	public class ViewPort {
		public static final String TAG = "ViewPort";

		/**
		 * left : -0.2017
		 * top : -0.3603
		 * width : 0.4998
		 * height : 0.3328
		 * color :
		 * visible : true
		 * text : 图片1
		 */

		private double	left;
		private double	top;
		private String	width;
		private double	height;
		private String	color;
		private boolean	visible;
		private String	text;

		public double getLeft() {
			return left;
		}

		public void setLeft(double left) {
			this.left = left;
		}

		public double getTop() {
			return top;
		}

		public void setTop(double top) {
			this.top = top;
		}

		public double getWidth() {
			try {
				return Double.parseDouble(width);
			} catch (Exception e) {
				Logger.t(TAG).e(e.getMessage());
			}
			return -1;
		}

		public void setWidth(String width) {
			this.width = width;
		}

		public double getHeight() {
			return height;
		}

		public void setHeight(double height) {
			this.height = height;
		}

		public String getColor() {
			return color;
		}

		public void setColor(String color) {
			this.color = color;
		}

		public boolean isVisible() {
			return visible;
		}

		public void setVisible(boolean visible) {
			this.visible = visible;
		}

		public String getText() {
			return text;
		}

		public void setText(String text) {
			this.text = text;
		}
	}

	public static class CountRule {
		/**
		 * min : 4
		 * step : 2
		 * max : 10
		 */

		private int		min;
		private int		step;
		private int		max;
		private String	group;

		public String getGroup() {
			return group;
		}

		public void setGroup(String group) {
			this.group = group;
		}

		public int getMin() {
			return min;
		}

		public void setMin(int min) {
			this.min = min;
		}

		public int getStep() {
			return step;
		}

		public void setStep(int step) {
			this.step = step;
		}

		public int getMax() {
			return max;
		}

		public void setMax(int max) {
			this.max = max;
		}
	}
}
